// Creato il 02/gen/2012
package it.mozzicato.apkwizard.dto;

import it.mozzicato.apkwizard.*;

import java.io.*;
import java.util.*;

import org.apache.commons.io.*;


/**
 * @author Roberto Mozzicato
 *
 */
public class SortableLocale implements Comparable<SortableLocale>, StatusObject {
	private Locale locale;
	private File directory;
	private ResourceStatus status=ResourceStatus.ORIGINAL; 
	
	public SortableLocale(Locale locale) {
		this.locale=locale;
		directory = new File(locale.toString().isEmpty() ? "values" : "values-" + locale.toString().replace("_", "-r"));
	}
	
	public SortableLocale(Locale locale, File dir) {
		this.locale=locale;
		this.directory=dir;
	}

	@Override
	public String toString() {
		return locale.getDisplayName() + " - " + locale.toString();
	}
	
	@Override
	public int compareTo(SortableLocale o) {
		if(o==null) return 1;
		return locale.getDisplayName().compareTo(o.locale.getDisplayName());
	}
	
	public File getDirectory() {
		return directory;
	}

	public void setDirectory(File directory) {
		this.directory = directory;
	}

	public Locale getLocale() {
		return locale;
	}

	public ResourceStatus getStatus() {
		return status;
	}

	public void setStatus(ResourceStatus status) {
		this.status = status;
	}
}